package main

import (
	"flag"
	"fmt"
	"os"
)

func main() {
	// command-line arguments
	fmt.Println(os.Args)
	methodPtr := flag.String("method", "GET", "HTTP Request Method")
	portPtr := flag.Int("port", 443, "Server Listening Port")
	fmt.Printf("Default HTTP Method = %s\n", *methodPtr)
	fmt.Printf("Default Server Port = %d\n", *portPtr)
	// program-entry arguments
	var (
		method string
		port   int
	)
	flag.StringVar(&method, "Method", "PUT", "HTTP Request Method")
	flag.IntVar(&port, "Port", 666, "Server Listening Port")
	flag.Parse()
	fmt.Printf("CMD HTTP Method = %s\n", *methodPtr)
	fmt.Printf("CMD Server Port = %d\n", *portPtr)
	fmt.Printf("CUSTOM HTTP Method = %s\n", method)
	fmt.Printf("CUSTOM Server Port = %d\n", port)
}
